<%@page contentType="text/html; charset=UTF-8" language="java" %>
<%@include file="tag.jsp" %>
<%@taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <link rel="icon" href="${ctx}/static/plugins/bootstrap-3.3.0/img/favicon.ico">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>商城高并发抢单-商品列表</title>
    <!-- Bootstrap core CSS -->
    <link href="${ctx}/static/plugins/bootstrap-3.3.0/css/dashboard.css" rel="stylesheet">
    <%@include file="head.jsp" %>
    <!-- Custom styles for this template -->
</head>

<body>


<div class="container-fluid">
    <div class="row">
        <nav class="col-md-2 d-none d-md-block bg-light sidebar">
            <div class="sidebar-sticky">
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link active" href="javascript:location.reload();">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
                                <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                                <polyline points="9 22 9 12 15 12 15 22"></polyline>
                            </svg>
                             商品信息<span class="sr-only">(current)</span>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="${ctx}/admin/toLogin">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file">
                                <path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path>
                                <polyline points="13 2 13 9 20 9"></polyline>
                            </svg>
                            管理后台
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="${ctx}/to/login">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
                                <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                                <circle cx="9" cy="7" r="4"></circle>
                                <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
                                <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
                            </svg>
                            切换用户
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="${ctx}/to/login">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart-2">
                                <line x1="18" y1="20" x2="18" y2="10"></line>
                                <line x1="12" y1="20" x2="12" y2="4"></line>
                                <line x1="6" y1="20" x2="6" y2="14"></line>
                            </svg>
                            退出登录
                        </a>
                    </li>
                </ul>

            </div>
        </nav>

        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>商城高并发抢单-秒杀商品列表</h2>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <td style="font-size: 15px"><strong style="color: red">商品名称</strong></td>
                        <td style="font-size: 15px"><strong style="color: red">剩余数量</strong></td>
                        <td style="font-size: 15px"><strong style="color: red">开始时间</strong></td>
                        <td style="font-size: 15px"><strong style="color: red">结束时间</strong></td>
                        <td style="font-size: 15px"><strong style="color: red">查看详情</strong></td>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${list}" var="item">
                        <tr>
                            <td>${item.itemName}</td>
                            <td>${item.total}</td>
                            <td><fmt:formatDate value="${item.startTime}" pattern='yyyy-MM-dd HH:mm:ss'/></td>
                            <td><fmt:formatDate value="${item.endTime}" pattern='yyyy-MM-dd HH:mm:ss'/></td>
                            <td>
                                <c:choose>
                                    <c:when test="${item.canKill==1}">
                                        <a class="btn btn-sm btn-info" href="${ctx}/item/detail/${item.id}" target="_blank">查看商品详情</a>
                                    </c:when>
                                    <c:otherwise>
                                        <a class="btn btn-sm
                                       btn-secondary" target="_blank">商品抢购未开始！</a>
                                    </c:otherwise>
                                </c:choose>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="${ctx}/static/plugins/bootstrap-3.3.0/js/jquery-3.2.1.slim.min.js"></script>
<script type="text/javascript" src="${ctx}/static/plugins/bootstrap-3.3.0/js/popper.min.js"></script>


<!-- Icons -->
<script type="text/javascript" src="${ctx}/static/plugins/bootstrap-3.3.0/js/feather.min.js"></script>


<script src="${ctx}/static/plugins/jquery.js"></script>
<script src="${ctx}/static/plugins/bootstrap-3.3.0/js/bootstrap.min.js"></script>


<!-- Graphs -->
<script type="text/javascript" src="${ctx}/static/plugins/bootstrap-3.3.0/js/Chart.min.js"></script>

</body>

</html>







